feat: migration for unique connections #9076
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
About the changes
We need to store unique connections from SDKs.
The id will be current or previous string for current or previous hour. We only need to have 2 buckets for metrics reporting in grafana/victoriametrics.
The hll is hyperloglog bytes array used for the internal data structure of the HyperLogLog for unique connection tracking. We serialize it to a database because we want to have unique tracking across multiple pods.
Extracted this migration from a bigger PR: #9074
Actual usage of the byte array serialization/deserialization is shown here: https://github.com/Unleash/unleash/pull/9074/files#diff-309cb0c2c562243279e6a15f9d9d7f4ddd33ae6ba526016e1e1b708209ecb877R27
Important files
Discussion points